﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using dtSearch.Engine;

namespace DtSearchIndexService
{
    [Serializable]
    public class IndexJobSettings
    {
        public string IndexPath;
        public StringCollection FoldersToIndex = new StringCollection();
        public StringCollection IncludeFilters = new StringCollection();
        public StringCollection ExcludeFilters = new StringCollection();
        public StringCollection IndexesToMerge = new StringCollection();
        public bool ActionCreate;
        public bool ActionAdd;
        public bool ActionRemoveDeleted;
        public bool ActionRemoveListed;
        public bool ActionCompress;
        public bool ActionVerify;
        public bool ActionMerge;
        public int MaxMemToUseMB;
        public int AutoCommitIntervalMB;
        public IndexingFlags IndexingFlags;
        public StringCollection StoredFields = new StringCollection();
        public string TempFileDir;

        public void CopyTo(IndexJob job)
        {
            job.IndexPath = IndexPath;
            job.FoldersToIndex = FoldersToIndex;
            job.IncludeFilters = IncludeFilters;
            job.ExcludeFilters = ExcludeFilters;
            job.IndexesToMerge = IndexesToMerge;
            job.IndexingFlags = IndexingFlags;
            job.MaxMemToUseMB = MaxMemToUseMB;
            job.AutoCommitIntervalMB = AutoCommitIntervalMB;
            job.ActionCreate = ActionCreate;
            job.ActionAdd = ActionAdd;
            job.ActionRemoveDeleted = ActionRemoveDeleted;
            job.ActionCompress = ActionCompress;
            job.ActionVerify = ActionVerify;
            job.ActionRemoveListed = ActionRemoveDeleted;
            job.StoredFields = StoredFields;
            job.TempFileDir = TempFileDir;
        }

        public void CopyFrom(IndexJob job)
        {
            IndexPath = job.IndexPath;
            FoldersToIndex = job.FoldersToIndex;
            IncludeFilters = job.IncludeFilters;
            ExcludeFilters = job.ExcludeFilters;
            IndexesToMerge = job.IndexesToMerge;
            IndexingFlags = job.IndexingFlags;
            MaxMemToUseMB = job.MaxMemToUseMB;
            AutoCommitIntervalMB = job.AutoCommitIntervalMB;
            ActionCreate = job.ActionCreate;
            ActionAdd = job.ActionAdd;
            ActionRemoveDeleted = job.ActionRemoveDeleted;
            ActionCompress = job.ActionCompress;
            ActionVerify = job.ActionVerify;
            ActionRemoveListed = job.ActionRemoveDeleted;
            StoredFields = job.StoredFields;
        }
    }
}
